package common.util 
{
	import flash.geom.Point;
	/**
	 * ...
	 * @author Surui
	 */
	public class Vector2DUtil 
	{
		
		public function Vector2DUtil() 
		{
			
		}
		
		/**
		 * 获取投影
		 * @param	a_point0
		 * @param	a_point1
		 * @param	b_point0
		 * @param	b_point1
		 * @return
		 */
		public static function getCrossPoint( a_point0:Point, a_point1:Point, b_point0:Point, b_point1:Point ):Point {
			var k_a:Number = ( a_point1.y - a_point0.y ) / ( a_point1.x - a_point0.x );
			var k_b:Number = ( b_point1.y - b_point0.y ) / ( b_point1.x - b_point0.x );
			var c_a:Number = ( a_point0.y * a_point1.x - a_point0.x * a_point1.y ) / ( a_point1.x - a_point0.x );
			var c_b:Number = ( b_point0.y * b_point1.x - b_point0.x * b_point1.y ) / ( b_point1.x - b_point0.x );
			var x:Number = (c_b - c_a) / (k_a - k_b);
			var y:Number = (c_b * k_a - c_a * k_b) / (k_a - k_b);
			return new Point( x, y );
		}
		
	}

}